From 6f25260a8254080a6ea6423b5853985ca4df3187 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Fri, 6 Dec 2013 15:39:01 -0400 Subject: [PATCH] Fix text extraction on DjVu so that it works beyond first call. This was caching the metadata tree in-process, but it was returning this cache even for calls for things other then this item. As a result, if you did $file->getHandler()->getPageText( $file, 2 ) twice in a single request, the second time it would return false. Change-Id: I6ee4dce3177c0898e98210d7471cfadc1108ca52 --- includes/media/DjVu.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index ae46b2e855..cbb3ec2ad5 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -232,7 +232,10 @@ class DjVuHandler extends ImageHandler { * @return bool */ function getMetaTree( $image, $gettext = false ) { - if ( isset( $image->dejaMetaTree ) ) { + if ( $gettext && isset( $image->djvuTextTree ) ) { + return $image->djvuTextTree; + } + if ( !$gettext && isset( $image->dejaMetaTree ) ) { return $image->dejaMetaTree; } -- 2.20.1